import request from '@/utils/request'

// 创建工序
export function createProcedure(data) {
  return request({
    url: '/basic/procedure/create',
    method: 'post',
    data: data
  })
}

// 更新工序
export function updateProcedure(data) {
  return request({
    url: '/basic/procedure/update',
    method: 'put',
    data: data
  })
}

// 删除工序
export function deleteProcedure(id) {
  return request({
    url: '/basic/procedure/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除工序 */
export function deleteProcedureList(ids) {
  return request({
    url: `/basic/procedure/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得工序
export function getProcedure(id) {
  return request({
    url: '/basic/procedure/get?id=' + id,
    method: 'get'
  })
}

// 获得工序分页
export function getProcedurePage(params) {
  return request({
    url: '/basic/procedure/page',
    method: 'get',
    params
  })
}
// 导出工序 Excel
export function exportProcedureExcel(params) {
  return request({
    url: '/basic/procedure/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}